//
// Code snippets
//

code,
pre {
  font-family: Consolas,"Liberation Mono",Menlo,Courier,monospace;
  font-size: 12px;
}

code {
  color: darken(saturate($main-color, 50%), 10%);
  background-color: darken($main-bg-color, 5%);
}

// Inline code
code {
  padding: 0;
  padding-top: 0.2em;
  padding-bottom: 0.2em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(0, 0, 0, 0.04);
  border-radius: 3px;

  &:before,
  &:after {
    letter-spacing: -0.2em;
    content: "\00a0";
  }
}

// No spacer in code blocks
pre code {
  &:after {
    content: none;
  }
}

// Code blocks
.highlight {
  margin: 0 0 $spacer3;
  border-radius: 4px;
  background-color: $gray-0;
  border: $border;

  pre {
    padding: $spacer3;
    overflow: auto;
    font-size: 16px;
    line-height: 1.45;

    code {
      display: inline;
      max-width: initial;
      padding: 0;
      margin: 0;
      overflow: initial;
      line-height: inherit;
      word-wrap: normal;
      background-color: transparent;
      border: 0;

      &:before,
      &:after {
        content: none;
      }
    }
  }
}

// Example styles

.example {
  padding: $spacer3;
  border: $border;
  border-top-left-radius: $border-radius;
  border-top-right-radius: $border-radius;

  + .highlight {
    margin-bottom: $spacer3;
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

pre {
  margin-bottom: 10px;
}

// make code in headers a bit stronger
h1,
h2,
h3,
h4 {
  code {
    background-color: darken($main-bg-color, 5%);
  }
}

span.shell-one-liner {
  font-family: $code-font-family;
  padding: 10px;
  border-radius: 2px;
  line-height: 2;

  &:before {
    content: "$ ";
    opacity: 0.5;
  }
}
